import { fileURLToPath } from 'node:url'
import path from 'node:path'
import { app } from 'electron'

const __app_root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..')

/**
 * 获取可执行文件所在目录下的文件
 * @param dirPath 目录
 */
const getExeDir = () => {
    return app.isPackaged ? path.dirname(process.execPath) : __app_root;
}

/**
 * 获取resources目录path
 * @returns 
 */
const getResourcesDirPath = () => {
    return path.join(getExeDir(), "./resources")
}

export {
    getResourcesDirPath,
    getExeDir
}